package com.csun.dsms.service.impl;

import com.csun.dsms.comment.core.support.BaseService;
import com.csun.dsms.mapper.YsClassesMapper;
import com.csun.dsms.mapper.YsStudentMapper;
import com.csun.dsms.model.domain.YsClasses;
import com.csun.dsms.model.domain.YsStudent;
import com.csun.dsms.model.dto.ys.YsQueryDto;
import com.csun.dsms.model.dto.ys.YsStudentVo;
import com.csun.dsms.service.YsClassesService;
import com.csun.dsms.service.YsStudentService;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class YsStudentServiceImpl extends BaseService<YsStudent> implements YsStudentService {

    @Resource
    private YsStudentMapper ysStudentMapper;


    @Override
    public Integer addStudent(YsStudent ysStudent) {
        return ysStudentMapper.insertSelective(ysStudent);
    }

    @Override
    public Integer deleteStudentById(Long id) {
        return ysStudentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Integer editStudent(YsStudent ysStudent) {
        return ysStudentMapper.updateByPrimaryKeySelective(ysStudent);
    }

    @Override
    public List<YsStudent> queryListWithPage(YsQueryDto ysQueryDto) {
        PageHelper.startPage(ysQueryDto.getPageNum(),ysQueryDto.getPageSize());
        return ysStudentMapper.queryListWithPage(ysQueryDto);
    }

    @Override
    public YsStudentVo queryByStudent(YsStudent ysStudent) {
        return ysStudentMapper.queryByStudent(ysStudent);
    }
}
